<template>
  <div class="coupon-page">
    <!-- 顶部导航栏（返回键 + 标题） -->
    <div class="header">
      <div class="back-btn" @click="handleBack">
        <span class="arrow">&lt;</span> <!-- 纯CSS返回箭头 -->
      </div>
      <h1 class="title">红包卡券</h1>
    </div>

    <!-- 卡券列表 -->
    <div class="coupon-list">
      <div v-for="(item, index) in couponItems" :key="index" class="coupon-item">
        <img :src="item.icon" alt="icon" class="item-icon" />
        <span class="item-title">{{ item.title }}</span>
        <span class="arrow-right">&gt;</span> <!-- 右侧箭头（可点击跳转） -->
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();

// 卡券数据（示例，替换为实际数据）
const couponItems = ref([
  { title: '我的红包', icon: '/mycoupon/red-packet.png' },
  { title: '我的抽奖', icon: '/mycoupon/lottery.png' },
  { title: '助卖宝卡', icon: '/mycoupon/assist-card.png' },
  { title: '我的寄件券', icon: '/mycoupon/delivery-coupon.png' },
  { title: '我的加价券', icon: '/mycoupon/price-up-coupon.png' },
  { title: '我的验货券', icon: '/mycoupon/inspection-coupon.png' },
  { title: '我的彩票券', icon: '/mycoupon/lottery-ticket.png' },
  { title: '交易安全金', icon: '/mycoupon/security-fund.png' },
  { title: '我的购物券', icon: '/mycoupon/shopping-coupon.png' },
]);

// 返回上一页
const handleBack = () => {
  router.back();
};
</script>

<style scoped>
.coupon-page {
  background-color: #f8f8f8;
  min-height: 100vh;
  padding: 15px;
}

.header {
  position: relative;
  display: flex;
  align-items: center;
  padding: 16px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  margin-bottom: 15px;
}

.back-btn {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.arrow {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.title {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  margin: 0 auto; /* 标题水平居中 */
}

.coupon-list {
  background-color: #fff;
  border-radius: 8px;
  padding: 10px;
}

.coupon-item {
  display: flex;
  align-items: center;
  justify-content: space-between; /* 左右对齐（图标+标题，右侧箭头） */
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.item-icon {
  width: 30px;
  height: 30px;
  margin-right: 15px;
}

.item-title {
  font-size: 16px;
  color: #333;
  flex: 1; /* 标题占满中间空间 */
}

.arrow-right {
  font-size: 16px;
  color: #999;
  cursor: pointer; /* 右侧箭头可点击（可添加跳转逻辑） */
}
</style>